Skip to content

fix(studio): a sealed empty box drags on the press right after its select click - #8772

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/studio-sealed-empty-box-drags
Nov 25, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/studio-sealed-empty-box-drags

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

On a sealed preview, pressing an empty box right after the click that selects it now drags the box, as it does on a regular preview. Before, that press opened a text edit on the empty box and the drag moved nothing.

Why

A click that selects a box and the press that starts its drag a moment later land within Studio's double-press window. That pair is a double press, which opens the pressed layer's text for editing, if the layer has text to edit.

  • Regular preview: canEditElementTextInline needs non-empty text, so an empty box opens nothing and the press drags.
  • Sealed preview: canEditSealedTextInline never looked at the text. The press opened a text edit on the empty box, and the drag was swallowed.

On the edit-accuracy bench (seqab-none-px-r0-nested-z100: drag A, then select and drag B, then A again, inside a nested composition), the sealed run on main never saved B. B tracked 248 px off the pointer, the third drag landed 10 s late, and undo grouping failed. A regular run passes. Studio's select and drag traces for the press on B show the text path taken sealed and not unsealed.

Related work

Refs #7846 (Studio's preview sealed by default): this is one of the edit-accuracy cases that fail only sealed.

How

components/editor/domEditInlineText.ts: canEditSealedTextInline also needs the selection's text (textContent, which a sealed selection carries already trimmed from the frame's description) to be non-empty. This is the same rule canEditElementTextInline applies to a live element. Whitespace-only text counts as empty in both modes.

Test plan

  • fails without the fix: opens no sealed text edit on a box with no text, as a regular preview opens none in src/hooks/inlineTextEdit.sealed.test.ts failed on main with expected true to be false. It checks an empty box and a whitespace-only box in both modes, and that a box with text still opens.
  • On the devbox: that file 3 runs, green. The 8 Studio test files that cover the changed file, green. tsc, Fallow and the pre-push hooks clean.
  • Edit-accuracy bench on the old Mac, with this change, both modes: every seqab-none-* case (6) and every text case (textedit, textselect, 4) accurate sealed and unsealed. A real double press on text still opens and saves it.
  • Real app: Studio's dev server at this branch on the devbox, the bench's nested fixture, drag A, then click B and press it 250 ms later to drag it.
runs B (#other) after its drag A (#target)
sealed, without this change 2 not moved, not saved (one run left B open for text editing) translate: 322.815px 218.543px
sealed, this branch 6 translate: -179.967px 187.119px in 5 runs translate: 322.815px 218.543px
regular, this branch 2 translate: -179.967px 187.119px translate: 322.815px 218.543px

The one sealed run on this branch that did not move B was the first on a freshly started dev server, before the select trace was on; the four traced runs after it all match the regular preview.

Before

Sealed, without this change: B (blue) stays where it was, held open for text editing, and its drag moved nothing.

Sealed, without this change: the blue box held open for text editing, not moved

After

Sealed, this branch: B is where the drag let it go, selected with its handles.

Sealed, this branch: the blue box moved where the drag let go, selected

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 67 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at cc137c23.

  • The fix is the missing rule, nothing more. canEditSealedTextInline now refuses a selection whose textContent is empty or whitespace-only. That is the same rule canEditElementTextInline applies to a live element ((element.textContent ?? "").trim().length > 0). So the press that follows a selecting click on an empty box drags it in both modes instead of opening a text edit there.
  • The sealed text is a fair stand-in for the live one.
    • A sealed selection's textContent is current.text.trim() || null (previewSelection.ts), from the frame's renderedTextOf. That walks every text node under the element and skips only script/style text.
    • The live check never opens on an element with such children anyway (hasOnlyFormattingChildren), so the two modes agree on what counts as empty.
  • Only this gate changes. canOpenTextInline routes sealed selections through it, and nothing else reads canEditSealedTextInline.
  • Fails without the fix: the body names inlineTextEdit.sealed.test.ts › "opens no sealed text edit on a box with no text, as a regular preview opens none". It covers an empty box, a whitespace-only box, and a box with text that must still open, in both modes. The before/after captures show the same drag on the bench fixture.

Need: a sealed drag right after its selecting click moved and saved the wrong layer · Size: right (one line, plus tests) · Reuse: the same rule as the live check · Simpler: yes · Structure: fine

Risk: low. The sealed gate only gets stricter, and only for boxes with no text to edit.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 614ece8 Nov 25, 2026
125 of 126 checks passed
@miguel-heygen
miguel-heygen deleted the fix/studio-sealed-empty-box-drags branch November 25, 2026 04:47
@miguel-heygen miguel-heygen mentioned this pull request Nov 25, 2026
3 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants